package me.andy.superappsorganizer;

import me.andy.superappsorganizer.model.SAppsDatabase;
import me.andy.superappsorganizer.model.SuperAppsOrganizerProvider;
import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.CursorAdapter;
import android.widget.GridView;
import android.widget.SimpleCursorAdapter;

public class GridAppsActivity extends Activity {
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        setContentView(R.layout.grid_app_list);
            
        GridView gridview = (GridView) findViewById(R.id.gridview);
        
        String[] projection = { SAppsDatabase.ID, SAppsDatabase.COL_APP_TITLE};
        String[] uiBindFrom = { SAppsDatabase.COL_APP_TITLE };
        int[] uiBindTo = { R.id.title };
                
        Cursor apps =  managedQuery(
                SuperAppsOrganizerProvider.CONTENT_URI, projection, null, null, null);
     
        CursorAdapter adapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.list_item, apps,
                uiBindFrom, uiBindTo);
        gridview.setAdapter(adapter);

/*        String[] projection = { SAppsDatabase.ID, SAppsDatabase.COL_APP_TITLE};
        String[] uiBindFrom = { SAppsDatabase.COL_APP_TITLE };
        int[] uiBindTo = { R.id.title };
                
        Cursor apps =  managedQuery(
                SuperAppsOrganizerProvider.CONTENT_URI, projection, null, null, null);
        
        GridView gridview = (GridView) findViewById(R.id.gridview);
        
        CursorAdapter adapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.grid_app_list, apps,
                uiBindFrom, uiBindTo);
        
        gridview.setAdapter(adapter);*/
     
       
		
    }
}
